package com.woniuxy.controller;

import com.woniuxy.service.IAllRunService;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;

/**
 * @Author pml
 * @Date 2025/7/19 9:44
 * @Description TODO
 * 跑腿订单控制器
 * 命名规范：数据库表名(all_run)→Controller类名(AllRunController)
 * 与OrderRunController保持一致的接口设计风格
 */
@RestController
@RequestMapping("/api/all-run")
public class AllRunController {

    @Autowired
    private IAllRunService allRunService;

    /**
     * 获取订单状态分布统计数据
     * 接口路径与功能对应，便于前端理解和使用
     */
    @GetMapping("/status-distribution")
    public ResponseData<List<Map<String, Object>>> getOrderStatusDistribution() {
        return ResponseData.ok(allRunService.getOrderStatusDistribution());
    }
}